package jp.com.nobnak.commentviewer.cookie;

import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Set;


public class CookieDict {
	private HashMap<String, LinkedHashSet<String>> mMap;
	
	public CookieDict() {
		mMap = new HashMap<String, LinkedHashSet<String>>();
	}
	
	public String first(String key) {
		LinkedHashSet<String> found = mMap.get(key);
		if (found == null || found.isEmpty())
			return null;
		
		return found.iterator().next();
	}
	public Set<String> all(String key) {
		return mMap.get(key);
	}
	public void put(String key, String value) {
		LinkedHashSet<String> found = mMap.get(key);
		if (found == null) {
			found = new LinkedHashSet<String>();
			mMap.put(key, found);
		}
		found.add(value);
	}
	public Set<String> keys() { return mMap.keySet(); }
}
